package dp05.leertaak1.dao.definitions;

import java.util.LinkedList;

public abstract class DAO
{
    protected LinkedList<Integer> dataStructure;
    protected static volatile DAO instance = null;

    public DAO()
    {
        this.dataStructure = new LinkedList<Integer>();
    }

    public void insert(int number)
    {
        dataStructure.add(number);
    }

    public int total()
    {
        int total = 0;
        for (Integer number : dataStructure)
        {
            total += number;
        }
        return total;
    }

    public abstract LinkedList<Integer> get();

    public abstract void update();

    public Integer removeLast()
    {
        return dataStructure.removeLast();
    }

    public void cleanUp()
    {
        dataStructure.clear();
    }
}
